<p><a href="<?php echo $this->url(array('controller'=>'courrier', 
        'action'=>'add'));?>">Add new Courrier</a></p>

<table border=1>
<tr>
    <th>Titre</th>
    <th>Chapo</th> 
    <th>Newsletter</th> 
    <th>&nbsp;</th>
</tr>
<?php 
$model =$this->modelcourriernews;

?>
<?php for($index=0;$index<count($this->courriers);$index++) {?>

<?php $current = $this->courriers[$index] ;
		$id =$current['id'];
		$newsletters =$model->getCourrierByNewsletterName($id);
		$nbreNewsletter =count($newsletters);
?>
<tr>
    <td><?php echo $this->escape($current['titre']);?></td>
    <td><?php echo $this->escape($current['chapo']);?></td>
     <td>
     	
     	<?php
     	 for($j=0;$j<count($newsletters);$j++){
		$k = $newsletters[$j];
		echo $k['name'].'<br>';
		}?>
     	
 	</td>
 	<td>
 	<?php
     	
   if(count($newsletters)){ echo "<a href=".$this->url(array('controller'=>'courrier',
		'action'=>'send', 'id'=>$current['id'])).">Envoyer</a> | ";
   }
     echo "<a href=".$this->url(array('controller'=>'courrier',
		'action'=>'edit', 'id'=>$current['id'])).">Editer</a>";
     echo "<br>";      
?>
	 </td>
    
   
</tr>
<?php 

} ?>
</table>
<br>
<a href=<?php echo $this->url(array('controller'=>'auth','action'=>'logout'));?>>click here to logout</a>

